package com.ch.first;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

import cn.bmob.v3.Bmob;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;

import java.lang.String;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Bmob.initialize(this, "9ba2d0433b4da0e050f5a6c479449609");

        Person p2 = new Person();
        p2.setName("lucky");
        p2.setAddress("北京海淀");
        p2.save(new SaveListener<String>() {

            public void done(String objectId,BmobException e) {
                if(e==null){
                    Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
                }else{
                    Toast.makeText(MainActivity.this, "sucess", Toast.LENGTH_LONG).show();
                }
            }
        });

    }
}
